/* ****************************************************************************
 *
 * Copyright (c) Microsoft Corporation. 
 *
 * This source code is subject to terms and conditions of the Microsoft Public License. A 
 * copy of the license can be found in the License.html file at the root of this distribution. If 
 * you cannot locate the  Microsoft Public License, please send an email to 
 * dlr@microsoft.com. By using this source code in any fashion, you are agreeing to be bound 
 * by the terms of the Microsoft Public License.
 *
 * You must not remove this notice, or any other, from this software.
 *
 * THIS CODE AND INFORMATION ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY
 * KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A
 * PARTICULAR PURPOSE.
 * ***************************************************************************/




#if !defined(AFX_PGLLINE1D_H__920F8169_03FF_408A_B71F_468ECE5BC45D__INCLUDED_)
#define AFX_PGLLINE1D_H__920F8169_03FF_408A_B71F_468ECE5BC45D__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

#include <pgl/core/PGLLine.h>
#include <pgl/core/PGLData.h>

/*! \brief An 1D line.

\ingroup PGLLineGroup

This line contains height informations.
*/
class PGLCORE_EXT_CLASS CPGLLine1D : public CPGLLine
{
PGL_DECLARE_DYNCREATE(CPGLLine1D);
public:
	//! \name Contructors
	//@{
	//! Default constructor
	CPGLLine1D(const CPGLColor& _FrontColor = CPGLColor(), const CPGLColor& _FillColor = CPGLColor(1,1,1,1),
		EInterpolationType eInterpolationType = InterpolationTypeLinear,
		EMarkerType _eMarkerType = MarkerTypeNone,LPCTSTR _eDashPattern = PGL_LINE_CONT );
	//! Copy constructor
	CPGLLine1D(const CPGLLine1D& l): m_pValues(CPGLDataPtr())	{*this = l;};
	//! Assignement constructor
	CPGLLine1D& operator =(const CPGLLine1D& l);
	virtual ~CPGLLine1D();
	//@}

	//! \name Data setters and getters
	//@{
	//! Return i-th value
	double GetValue(UINT i) const		{	ASSERT(m_pValues); ASSERT(i>=0); ASSERT(m_pValues->size()); return (*m_pValues)[i];};
	//! Return values
	CPGLDataPtr GetValues()				{	return m_pValues;};
	//! Return values
	const CPGLDataPtr GetValues() const	{	return m_pValues;};
	//! Setting the data object
	virtual void SetValues( CPGLDataPtr pValues );
	/*! Setting data as vectors of double

	This is a helper function that uses the generic form of SetDatas and spares the user the creation of CPGLData objects.
	\param bMakeOwnCopy if true, a copy of the data is stored, otherwize only the reference is stored (default is true)
	*/
	void SetValues(const std::vector<double>& vValues, bool bMakeOwnCopy = true);
	/*! Setting data as vectors of float

	This is a helper function that uses the generic form of SetDatas and spares the user the creation of CPGLData objects.
	\param bMakeOwnCopy if true, a copy of the data is stored, otherwize only the reference is stored (default is true)
	*/
	void SetValues(const std::vector<float>& vValues, bool bMakeOwnCopy = true);
	/*! Setting data as vectors of int

	This is a helper function that uses the generic form of SetDatas and spares the user the creation of CPGLData objects.
	\param bMakeOwnCopy if true, a copy of the data is stored, otherwize only the reference is stored (default is true)
	*/
	void SetValues(const std::vector<int>& vValues, bool bMakeOwnCopy = true);
	/*! Setting data as vectors of BYTE

	This is a helper function that uses the generic form of SetDatas and spares the user the creation of CPGLData objects.
	\param bMakeOwnCopy if true, a copy of the data is stored, otherwize only the reference is stored (default is true)
	*/
	void SetValues(const std::vector<BYTE>& vValues, bool bMakeOwnCopy = true);
	//! Clears the data
	void ClearData();
	//@}

	//! \name Serialization and debugging
	//@{
	//! Serialization
	void SerializeXML(CPGLArchive& ar);
	#ifdef _DEBUG
		//! MFC Dump
	    virtual void Dump( CDumpContext& dc ) const;
		//! MFC AssertValid
	    virtual void AssertValid() const;   
	#endif
	//@}
protected:
	//! \name Attributes
	//@{
	//! Data
	CPGLDataPtr m_pValues;
	//@}
};

PGL_DECLARE_SMARTPTR( CPGLLine1D );

/*!  CPGLLine1DList
\ingroup PGLLineGroup
*/
typedef std::list<CPGLLine1DPtr> CPGLLine1DList;

/*!  CPGLLine1DVector
\ingroup PGLLineGroup
*/
typedef std::vector<CPGLLine1DPtr> CPGLLine1DVector;

#endif // !defined(AFX_PGLLINE1D_H__920F8169_03FF_408A_B71F_468ECE5BC45D__INCLUDED_)
